package helper;


import java.util.List;
import org.springframework.orm.hibernate3.HibernateTemplate;


/**
 * Hql查询助手类
 * @author deli.wu
 *
 */
public class HqlQueryHelper {
	private HibernateTemplate ht = null;
	public HqlQueryHelper(HibernateTemplate ht) {
		this.ht = ht;
	}
	public <T> List<T> find(String hql){
		return ht.find(hql);
	}
	public <T> List<T> find(String hql, Object[] params){
		return (List<T>)ht.find(hql, params);
	}
	public <T> T findfirst(String hql, Object[] params){
		List<T> ls = find(hql, params);
		if(ls.isEmpty())return null;
		return (T)ls.get(0);
	}
	
	
	

}
